# Maintainer: Thiago Perrotta <tbperrotta@gmail.com>
pkgname=typos
pkgver=1.23.2
pkgrel=0
pkgdesc="Source code spell checker"
url="https://github.com/crate-ci/typos"
arch="all"
license="MIT OR Apache-2.0"
makedepends="cargo cargo-auditable"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz
	update-libc-crate.patch"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 "target/release/$pkgname" -t "$pkgdir/usr/bin"
	install -Dm644 "LICENSE-MIT" "$pkgdir/usr/share/licenses/$pkgname/LICENSE-MIT"
	install -Dm644 "LICENSE-APACHE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE-APACHE"
}

sha512sums="
367588b0949acef83ed9bdd93dce785422b93e9bf58291c41efa2cfa1bec909c4c341498c81582df67d48d883ff9e74e178201f45220882f5d39c88771d825b8  typos-1.23.2.tar.gz
573c80eebb3c717b7e743c997345269d29800d18b2f6f17148a201cd0709e3ff7cbad94090ac6c92758854ad2032a1dd3b3d1f770943a7a3d3ab340ea41927b9  update-libc-crate.patch
"
